package com.bistu.xiong.controller;

import com.bistu.xiong.common.ServerResponse;
import com.bistu.xiong.pojo.TulingUser;
import com.bistu.xiong.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by XiongXiaoJun on 2019/4/9.
 */
@Controller
@RequestMapping("/user/")
public class UserController {

    @Autowired
    private IUserService iUserService;
    /**
     * 用户登录
     * @param phone
     * @param password
     * @return
     */
    //OK
    @RequestMapping(value = "login.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse<TulingUser> login(String phone, String password){
        //service-->mybatis-->dao
        ServerResponse<TulingUser> response = iUserService.login(phone,password);
        return response;
    }
    //OK
    @RequestMapping(value = "register.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse<TulingUser> register(TulingUser user){
        return iUserService.register(user);
    }

}
